#include "Node.h"

VNode::VNode(int x, int y, double g, double h, VNode* parent)
{
	this->x = x;
	this->y = y;
	this->g = g;
	this->h = h;
	this->f = g + h;
	this->parent = parent;
}

VNode::~VNode()
{
}

bool VNode::equal(int *pt)
{
	return this->x == pt[0] && this->y == pt[1];
}

bool VNode::equal(int x, int y)
{
	return this->x == x && this->y == y;
}

/**
* result < 0  this < other
* result ==0  this == other
* result > 0  this > other
*/
int VNode::compare(VNode * other)
{
	return this->getF() - other->getF();
}

bool operator<(VNode & n1, VNode & n2)
{
	if (n1.getF() < n2.getF())
	{
		return true;
	}
	return false;
	//return n1.getH() < n2.getH();
}

bool operator>(VNode & n1, VNode & n2)
{
	if (n1.getF() > n2.getF())
	{
		return true;
	}
	return false;
	//return n1.getH() > n2.getH();
}
